
<%@ page import="coe.pumbaa.User" %>

<html>
  <head>
    <meta name="layout" content="PumbaaLayout">
  <g:set var="entityName" value="${message(code: 'user.label', default: 'User')}" />
  <title>User Manager</title>
</head>
<body>
  
  <section id="main" class="column"> 
    <pumbaa:alert />
    <article class="module width_full">
      <header>
        <h3>User</h3>
      </header>
      <table class="tablesorter" cellspacing="0">
        <thead> 
          <tr>  
            <th>Email</th> 
            <th>First name</th> 
            <th>List name</th>
            <th>Display name</th>
            <th>Role</th>
            <th style="width: 10%;">Actions</th> 
          </tr> 
        </thead>
        <tbody>
        <g:each in="${userInstanceList}" var="userInstance">
          <tr>

            <td>${fieldValue(bean: userInstance, field: "email")}</td>

            <td>${fieldValue(bean: userInstance, field: "fname")}</td>
            
            <td>${fieldValue(bean: userInstance, field: "lname")}</td>
            
            <td>${fieldValue(bean: userInstance, field: "displayName")}</td>
            
            <td>${userInstance.role.type}</td>

            <td>
              <table id="show_action"><tr><td>
              <div id="blockSession${userInstance.id}">
            <g:render template="block" model="['user':userInstance]"/>
          </div>
                  </td>
                  <td><g:link action="edit" id="${userInstance.id}"><input type="image" src="${resource(dir: 'images', file: 'icn_edit.png')}" title="Edit"></g:link></td>
                <td><g:link action="delete" id="${userInstance.id}"><input type="image" src="${resource(dir: 'images', file: 'icn_trash.png')}" title="Trash" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');"></g:link></td>
          </tr></table>
              </td>

          </tr>
        </g:each>
        </tbody>
      </table>
      <footer>
        <div class="pagination">
          <h4><g:paginate total="${userInstanceTotal}" /></h4>
        </div>
      </footer>
    </article>
        <div class="submit_link">
            <g:link   action="listOfRequest"><g:actionSubmit class="alt_btn" name="gotoRequest" value="User Requests"/></g:link>
            <g:link  action="create"><g:actionSubmit class="alt_btn" name="createBtn" value="Create User"/></g:link>
        </div>
    <div class="spacer"></div>
  </section>
</body>
</html>
